/**
 * jims
 */
package com.jims.master.modules.base.inquiry.service;

import com.jims.master.common.service.CrudService;
import com.jims.master.modules.base.inquiry.dao.InquiryReplyDao;
import com.jims.master.modules.base.inquiry.entity.InquiryAsk;
import com.jims.master.modules.base.inquiry.entity.InquiryReply;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 问诊回复Service
 * @author chent
 * @version 2017-05-12
 */
@Service
@Transactional(readOnly = true)
public class InquiryReplyService extends CrudService<InquiryReplyDao, InquiryReply> {
    /**
     * 医生端问诊量
     * @param personId
     * @author chent
     * @return
     */
    public String getCountByDocId(String personId){
        return dao.getCountByDocId(personId);
    }

    /**
     * 修改用户已读状态
     * @author chent
     * @return
     */
    @Transactional(readOnly = false)
    public int updateState(List<InquiryAsk> doctorInquiryDetailList){
        int j = 0;
        for (int i = 0; i < doctorInquiryDetailList.size(); i++) {
            j = dao.updateState(doctorInquiryDetailList.get(i).getId());
        }
        return j;
    }

    /**
     * 用户未读问诊回复条数
     * @param askId
     * @return
     */
    public int getStatNum(String askId){
        return dao.getStatNum(askId);
    }
}